//
//  JDGCDemo.m
//  设计模式
//
//  Created by huyang on 2020/7/1.
//  Copyright © 2020 test. All rights reserved.
//

#import "JDGCDemo.h"
#import "Car.h"
#import "CarFactory.h"

@interface JDGCDemo ()
@property (weak, nonatomic) IBOutlet UILabel *showLabel;


@end

@implementation JDGCDemo

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)creatCarWithCarType:(CarType)type
{
    Car *car = [CarFactory creatCarWithType:type];
    NSString *carStr = [car getCar];
    _showLabel.text = [_showLabel.text stringByAppendingFormat:@"\n%@",carStr];
    
}

- (IBAction)creatJeep:(UIButton *)sender {
    [self creatCarWithCarType:CarType_JeepCar];
}
- (IBAction)creatSUV:(UIButton *)sender {
    [self creatCarWithCarType:CarType_SUVCar];
}
- (IBAction)creatBig:(UIButton *)sender {
    [self creatCarWithCarType:CarType_BigCar];
}


@end
